class Authorize < Remote
  class << self
    
    # singular resource
    def collection_name
      "authorize"
    end
    
    def request_ticket
      format.decode(post(:request_ticket, :api_key => CONFIG[:aireo_api_key]).body).symbolize_keys
    end
    
    def request_token(ticket_key)
      format.decode(post(:request_token, :api_key => CONFIG[:aireo_api_key], :ticket_key => ticket_key).body).symbolize_keys
    end
    
    def login_url
      site.to_s + '/login?' + redirect_query_params
    end
    
    def logout_url
      site.to_s + '/logout?' + redirect_query_params
    end
    
    def redirect_query_params
      'ticket_key=' + request_ticket[:key]
    end
    
  end
end